package weeek11.topic04;

import java.util.Set;

public class LruTest {
    public static void main(String[] args) {
        LruCache<Object,Object> cache = new LruCache<>(5);
        int i = 0;
        for (; i < 10; i++) {
            cache.put(i,i+"-v");
            print(i,cache);
        }
        Object o = cache.get(5);
        print(i,cache);
        System.out.println("get:"+o);
        cache.put(i,i+"-v");
        print(i,cache);

    }

    private static void print(int i, LruCache<Object, Object> cache) {
        System.out.println("===============");
        System.out.println("当前循环次数:"+i);
        System.out.println("数据:");
        Set<Object> keySet = cache.keySet();
        for (Object key : keySet) {
            System.out.println(key);
            //System.out.println(cache.get(key));
        }

    }


}
